package com.pj.project4sp.quartz;

import com.pj.project4sp.sp_mqqt_log.MqttServerMessageListener;

import com.pj.project4sp.sp_mqqt_log.SpMqqtLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@EnableScheduling
@Component
public class QuartzScheduleAn {
    @Autowired
    MqttServerMessageListener mqttServerMessageListener;
    @Autowired
    SpMqqtLogService spMqqtLogService;

    @Scheduled(cron="0/3 * * * * ?")
    public void delect(){
        mqttServerMessageListener.run();
    }


//    @Scheduled(cron="0 */5 * * * ?")
//    @Scheduled(cron="0/3 * * * * ?")
//    @Scheduled(fixedRate = 1800000)
    public void getByDeviceType(){
        spMqqtLogService.getByDeviceType();
    }

//    @Scheduled(cron="0 */15 * * * ?")
//    @Scheduled(fixedRate = 2400000)
    public void getMqqtLogList(){
        spMqqtLogService.getMqqtLogList();
    }

//    @Scheduled(cron="0 */30 * * * ?")
//    @Scheduled(cron="0/3 * * * * ?")
//    @Scheduled(fixedRate = 3600000)
    public void getMqqtLogListTime(){
        spMqqtLogService.getMqqtLogListTime();
    }
}
